package org.ccay.excel.importer.validate.impl;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.ccay.excel.importer.validate.AbstractValidator;
import org.ccay.excel.importer.validate.IStatus;
/**
 * 栏目管理导入字符编码验证
 * @author chaowangbang
 *
 */
public class ForbiddenCharacterCodeValidator extends AbstractValidator{
	
	/**
	 * 异常编码
	 */
	public static final String EXCEl_ERROR = "ccay.excel.validate.characterCoding.error";
	@Override
	protected IStatus doValidate(Object value) {
			if (value==null) {
				return IStatus.Ok;
			}
			/**
			 * 导入内容格式
			 */
			Pattern pattern=Pattern.compile("[<>?!@#$%\\\\\\/]+");
			Matcher matcher=pattern.matcher(value.toString());
			if(matcher.find()){
				return error();
			}
			return IStatus.Ok;
	}
}
